//
//  ClassViewController.m
//  GiftSay
//
//  Created by lanou on 15/12/16.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "ClassViewController.h"

@interface ClassViewController ()

@end

@implementation ClassViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
#warning  --------------------------分段控制器
    UISegmentedControl *segmentControl=[[UISegmentedControl alloc]initWithItems:@[@"攻略",@"礼物"]];
    segmentControl.frame=CGRectMake(40, 30, 300, 30);
    segmentControl.backgroundColor=[UIColor whiteColor];
    segmentControl.selectedSegmentIndex=0;
    [segmentControl setTitle:@"攻略" forSegmentAtIndex:0];
     [segmentControl setBackgroundColor:[UIColor redColor]];

    [segmentControl addTarget:self action:@selector(changeValueAction:) forControlEvents:(UIControlEventValueChanged)];
    self.navigationController.navigationBar.barTintColor=[UIColor redColor];
    [self.navigationController.view addSubview:segmentControl];
}
///分段控件触发方法
- (void)changeValueAction:(UISegmentedControl *)segmentedControl{
    
    NSLog(@"%ld",segmentedControl.selectedSegmentIndex);
    
    //判断当前选中控件的下标
    switch (segmentedControl.selectedSegmentIndex) {
        case 0:
        {
            self.view.backgroundColor = [UIColor whiteColor];
            
     //       [self.view addSubview:_loginView];
            
            
            
          //  [_registerView removeFromSuperview];
            
      //      [_findView removeFromSuperview];
            
        }
            break;
            
        case 1:{
            self.view.backgroundColor = [UIColor yellowColor];
            
//            [self.view addSubview:_registerView];
//            
//            
//            
//            [_loginView removeFromSuperview];
//            
//            [_findView removeFromSuperview];
            
        }
            break;
            
            
        default:
            break;
    }
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
